<template>
    <div>
       <Count1/>
       <hr>
       <Count2 ref = "laoliu" />

       <button @click = "getref" >获取Count2组件上的ref</button>
    </div>
</template>

<script>
//引入组件
import Count1 from "./components/Count1";
import Count2 from "./components/Count2";
export default {
  name: "App",
  //注册组件
  components: {
    Count1,
    Count2,
  },
  data(){
    return{
        name: "APP"
    }
  },

  methods: {
    getref(){
        console.log(this); //App组件实例
        console.log(this.$refs.laoliu); //Count2组件实例
    }
  },
};
</script>


<style>
</style>